package com.ys.web.pay.model.po;

import com.ys.utils.base.j2se.Convert;
import com.ys.utils.base.j2se.StringHandler;
import com.ys.utils.spring.config.SystemError;
import com.ys.utils.spring.properties.Config;
import lombok.Data;

/**
 * 钱包开户bean
 */
@Data
public class WithholdingCreate extends WalletBase{
    public String arrivalAmount;
    //是否免服务费
    public int noFee = 1;
    // 是否需要审核
    public boolean wait = false;

    public void check(){
        long compareMoney = StringHandler.parseMoney(this.getAmount());
        long min = StringHandler.getLong(Config.pp.get("wallet.withholding.money.min"));
        if (compareMoney < min) {
            SystemError.wrapBs("400", "提现金额不能小于" + StringHandler.moneyDesc(min) + "元");
        }
        long max = StringHandler.getLong(Config.pp.get("wallet.withholding.money.max"));
        if (compareMoney > max) {
            SystemError.wrapBs("400", "提现金额不能大于" + StringHandler.moneyDesc(max) + "元");
        }

        //风控规则
        if(compareMoney>StringHandler.getLong(Config.pp.get("wallet.withholding.wait.money"))){
            this.wait = true;
        }

        this.setAmount(String.valueOf(StringHandler.yuanToFen(this.getAmount())));
    }

    public String getArrivalAmount() {
        return arrivalAmount;
    }

    public void setArrivalAmount(String arrivalAmount) {
        this.arrivalAmount = arrivalAmount;
    }

    public int getNoFee() {
        return noFee;
    }

    public void setNoFee(int noFee) {
        this.noFee = noFee;
    }

    public boolean isWait() {
        return wait;
    }

    public void setWait(boolean wait) {
        this.wait = wait;
    }
}
